﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:Moonwish.Silverlight.Controls">
    <Style TargetType="local:DropTreeView">
        <Setter Property="Background" Value="#FFFFFFFF"/>
        <Setter Property="Foreground" Value="#FF000000"/>
        <Setter Property="HorizontalContentAlignment" Value="Left"/>
        <Setter Property="VerticalContentAlignment" Value="Top"/>
        <Setter Property="Cursor" Value="Arrow"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Padding" Value="1"/>
        <Setter Property="BorderBrush" Value="#FF000000"/>
        <Setter Property="IsTabStop" Value="True"/>
        <Setter Property="TabNavigation" Value="Once"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:DropTreeView">
                    <Border x:Name="borderContainer" Background="White" CornerRadius="3"
                            BorderBrush="#FF617584"
                            Padding="0"
                            BorderThickness="1">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0"/>
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="0" Duration="00:00:00.001" Storyboard.TargetProperty="(Rectangle.Stroke)" Storyboard.TargetName="BackGround">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    #FF747474
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames BeginTime="0" Duration="00:00:00.001" Storyboard.TargetProperty="(Rectangle.Fill)" Storyboard.TargetName="BackGround">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                        <GradientStop Color="#FFF3F4F5" Offset="1"/>
                                                        <GradientStop Color="White"/>
                                                    </LinearGradientBrush>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames BeginTime="0" Duration="00:00:00.001" Storyboard.TargetProperty="(Border.BorderBrush)" Storyboard.TargetName="DropArrow">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    #FF747474
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames BeginTime="0" Duration="00:00:00.001" Storyboard.TargetProperty="(Border.Background)" Storyboard.TargetName="DropArrow">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                        <GradientStop Color="#FFF3F4F5" Offset="1"/>
                                                        <GradientStop Color="White"/>
                                                    </LinearGradientBrush>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames BeginTime="0" Duration="00:00:00.001" Storyboard.TargetProperty="(Border.Margin)" Storyboard.TargetName="DropArrow">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    0, 1, 1, 1
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimation From="0.6" To="1" Storyboard.TargetProperty="(Border.Opacity)" Storyboard.TargetName="DropArrow"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid>
                            <Rectangle Fill="Transparent" StrokeThickness="1" x:Name="BackGround"></Rectangle>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*"></ColumnDefinition>
                                    <ColumnDefinition Width="auto"></ColumnDefinition>
                                </Grid.ColumnDefinitions>
                                <ContentControl x:Name="SelectedDisplay" Margin="5, 3, 0, 3" MinHeight="20" FontSize="{TemplateBinding FontSize}" VerticalAlignment="Center" Grid.Column="0" >
                                </ContentControl>
                                <Border x:Name="DropArrow" BorderBrush="#FF617584" Opacity="0.6" Background="White" BorderThickness="1, 0, 0, 0" Cursor="Hand" Grid.Column="1" Width="15">
                                    <Path Data="M35.355339,0 L70.710678,35.355339 L0,35.355339 z" Fill="Black" Height="4"  Width="6" Stretch="Fill" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Center" RenderTransformOrigin="0.5,0.5">
                                        <Path.RenderTransform>
                                            <CompositeTransform Rotation="180"/>
                                        </Path.RenderTransform>
                                    </Path>
                                </Border>
                                <Popup x:Name="ExpanderContainer" Opacity="0" Grid.ColumnSpan="2" VerticalAlignment="Bottom" Margin="0, 0, 0, -1">
                                    <ScrollViewer x:Name="ScrollViewer" BorderBrush="#FFBBBFC4" BorderThickness="1, 0, 1, 1" Width="{TemplateBinding Width}" Background="#FFFDFEFE" HorizontalScrollBarVisibility="Auto" IsTabStop="False" TabNavigation="Once" VerticalScrollBarVisibility="Auto">
                                        <ScrollViewer.Effect>
                                            <DropShadowEffect Color="#FFBBBFC4" BlurRadius="3" ShadowDepth="3"></DropShadowEffect>
                                        </ScrollViewer.Effect>
                                        <ItemsPresenter Margin="0, 0, 5, 5"/>
                                    </ScrollViewer>
                                </Popup>
                            </Grid>

                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
